<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="utf8"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Users</title>
</head>
<body>
<a href="<c:url value="?lang=en"/>">en</a>
<a href="<c:url value="?lang=ru"/> ">ru</a>
<br>
<a href="../data.htm"><spring:message code="label.dataManager"/></a>

	<h2>
		<spring:message code="data.user.title" />
	</h2>

	<form:form method="post" action="users/add" commandName="user" >
		<table>
			<tr>
				<td><form:label path="name">
						<spring:message code="data.user.name"/>
			</form:label>
				</td>
				<td><form:input path="name" />
				</td>
			</tr>
			<tr>
				<td><form:label path="surname">
						<spring:message code="data.user.surname"/>
			</form:label>
				</td>
				<td><form:input path="surname" />
				</td>
			</tr>
			<tr>
				<td><form:label path="country.id">
						<spring:message code="data.country.country"/>
				</form:label>
				</td>
				<td><form:select path="country.id">
						<option></option>
						<form:options items="${countries}" itemValue="id"  itemLabel="name" />
					</form:select></td>
			</tr>
			<tr>
				<td><form:label path="birthsday">
						<spring:message code="data.user.birthsday"/>
			</form:label>
				</td>
				<td><form:input path="birthsday" />
				</td>
			</tr>
			<tr>
				<td><form:label path="email">
						<spring:message code="data.user.email"/>
			</form:label>
				</td>
				<td><form:input path="email" />
				</td>
			</tr>
			<tr>
				<td><form:label path="password">
						<spring:message code="data.user.password"/>
			</form:label>
				</td>
				<td><form:input path="password" />
				</td>
			</tr>
			<tr>
				<td colspan="2"><input type="submit" value="<spring:message code="submit.add"/>" />
				</td>
			</tr>
		</table>
	</form:form>

	<h3>Users</h3>
	<c:if test="${!empty userList}">
		<table class="data">
			<tr>
				<th><spring:message code="data.user.name"/></th>
				<th><spring:message code="data.user.surname"/></th>
				<th><spring:message code="data.user.birthsday"/></th>
				<th><spring:message code="data.user.country"/></th>
				<th><spring:message code="data.user.email"/></th>
				<th><spring:message code="data.user.password"/></th>
				<th>&nbsp;</th>
			</tr>
			<c:forEach items="${userList}" var="user">
				<tr>
					<td>${user.name}</td>
					<td>${user.surname}</td>
					<td>${user.birthsday}</td>
					<td>${user.country.name}</td>
					<td>${user.email}</td>
					<td>${user.password}</td>
					<td><a href="users/delete/${user.id}.htm"><spring:message
								code="label.delete" /> </a>
					</td>
				</tr>
			</c:forEach>
		</table>
	</c:if>

</body>
</html>













